home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / itrns211.zip / SRC / YTABC < prev    next >
Text File  |  1991-12-14  |  31KB  |  1,002 lines

  1. #ifndef lint
  2. static char yysccsid[] = "@(#)yaccpar     1.7 (Berkeley) 09/09/90";
  3. #endif
  4. #define YYBYACC 1
  5. #line 2 "iyacc.y"
  6. /*
  7.  *========================================================================== 
  8.  * Copyright 1991 Avinash Chopde, All Rights Reserved.
  9.  *
  10.  * Permission to use, copy, modify and distribute this software and its
  11.  * documentation for any purpose is hereby granted without fee, provided that
  12.  * the above copyright notice appear in all copies and that both that
  13.  * copyright notice and this permission notice appear in supporting
  14.  * documentation, and that the name of Avinash Chopde not be used in
  15.  * advertising or publicity pertaining to distribution of the software
  16.  * without specific, written prior permission.
  17.  * Avinash Chopde makes no representations about the suitability of this
  18.  * software for any purpose.
  19.  * It is provided "as is" without express or implied warranty.
  20.  *
  21.  * AVINASH CHOPDE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  22.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  23.  * IN NO EVENT SHALL AVINASH CHOPDE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  24.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  25.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  26.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  27.  * OF THIS SOFTWARE.
  28.  *
  29.  * Author:  Avinash Chopde, 1991
  30.  *        C2 Colonial Drive #4, Andover, MA 01810, USA.
  31.  *
  32.  */
  33.  
  34. static char S_RCSID[] = "$Header: e:/itrans/src/rcs/iyacc.y 1.5 91/10/12 21:54:01 avinash Exp $";
  35.  
  36. #include <stdio.h>
  37. #include "itrans.h"
  38.  
  39. int G_lineno = 1; /* GLOBAL var: used by lex to indicate current line number */
  40.  
  41. #define WORD_LEN    511
  42.  
  43. /* Define a struct to keep track of the components of the letter, and
  44.  * the text representation of the word being parsed.
  45.  */
  46. static struct {
  47.     char word[WORD_LEN+1];
  48.     int curr_letter[WORD_LEN+1]; /* collect tokens regarding this letter here */
  49.     int nolig[WORD_LEN+1];/*collect nolig tokens here (see itrans.h, letter_t)*/
  50.     int curr_letter_n; /* number of tokens in curr_letter */
  51.     int curr_type; /* type of letter - special, vowel, cons, etc */
  52. } S_word;
  53.  
  54. char G_endprev_str[LINELEN]; /* used by ilex.l to  pass string to
  55.                   * process in case of the ENDPREV_TOK
  56.                   */
  57.  
  58. #define ADD_TOKEN(t) {    \
  59.     S_word.nolig[S_word.curr_letter_n] = FALSE;        \
  60.     S_word.curr_letter[S_word.curr_letter_n++] = t;    \
  61.     strcat(S_word.word, yytext);            \
  62. }
  63.  
  64. #define ADD_TOKEN_TYPE(t, typ) {            \
  65.     ADD_TOKEN(t);                    \
  66.     S_word.curr_type = typ;                \
  67. }
  68.  
  69. /* forward declarations (for prototypes) */
  70.  
  71. static void S_init_command();
  72. static void S_end_command();
  73. static void S_init_word();
  74. static void S_end_word();
  75. static void S_end_letter();
  76. static void S_init_letter();
  77. static void S_handle_other(char*);
  78.  
  79. #line 80 "y_tab.c"
  80. #define DUMMY_TOK 257
  81. #define A_TOK 258
  82. #define AA_TOK 259
  83. #define I_TOK 260
  84. #define II_TOK 261
  85. #define U_TOK 262
  86. #define UU_TOK 263
  87. #define RI_TOK 264
  88. #define RII_TOK 265
  89. #define LI_TOK 266
  90. #define LII_TOK 267
  91. #define AY_TOK 268
  92. #define AAY_TOK 269
  93. #define AI_TOK 270
  94. #define O_TOK 271
  95. #define OO_TOK 272
  96. #define AU_TOK 273
  97. #define AM_TOK 274
  98. #define AHA_TOK 275
  99. #define KA_TOK 276
  100. #define KHA_TOK 277
  101. #define GA_TOK 278
  102. #define GHA_TOK 279
  103. #define NGA_TOK 280
  104. #define CHA_TOK 281
  105. #define CHHA_TOK 282
  106. #define JA_TOK 283
  107. #define JHA_TOK 284
  108. #define JNH_TOK 285
  109. #define TTA_TOK 286
  110. #define TTHA_TOK 287
  111. #define DDA_TOK 288
  112. #define DDHA_TOK 289
  113. #define NNA_TOK 290
  114. #define TA_TOK 291
  115. #define THA_TOK 292
  116. #define DA_TOK 293
  117. #define DHA_TOK 294
  118. #define NA_TOK 295
  119. #define PA_TOK 296
  120. #define PHA_TOK 297
  121. #define BA_TOK 298
  122. #define BHA_TOK 299
  123. #define MA_TOK 300
  124. #define YA_TOK 301
  125. #define RA_TOK 302
  126. #define LA_TOK 303
  127. #define VA_TOK 304
  128. #define SHA_TOK 305
  129. #define SHHA_TOK 306
  130. #define SA_TOK 307
  131. #define HA_TOK 308
  132. #define LDA_TOK 309
  133. #define KSHA_TOK 310
  134. #define GYA_TOK 311
  135. #define NNX_TOK 312
  136. #define NYA_TOK 313
  137. #define RRA_TOK 314
  138. #define KADOT_TOK 315
  139. #define KHADOT_TOK 316
  140. #define GADOT_TOK 317
  141. #define DDADOT_TOK 318
  142. #define DDHADOT_TOK 319
  143. #define JADOT_TOK 320
  144. #define PHADOT_TOK 321
  145. #define RA_HALF_TOK 322
  146. #define ANUSVARA_TOK 323
  147. #define CHANDRA_TOK 324
  148. #define CHANDRA_BN_TOK 325
  149. #define VIRAAM_TOK 326
  150. #define AVAGRAHA_TOK 327
  151. #define SRI_TOK 328
  152. #define AUM_TOK 329
  153. #define BLANK_TOK 330
  154. #define NEWLINE_TOK 331
  155. #define NOLIG_TOK 332
  156. #define COMMAND_TOK 333
  157. #define ENDPREV_TOK 334
  158. #define ILANG_TOK 335
  159. #define MARATHI_TOK 336
  160. #define HINDI_TOK 337
  161. #define TAMIL_TOK 338
  162. #define BENGALI_TOK 339
  163. #define TELUGU_TOK 340
  164. #define MALAYALAM_TOK 341
  165. #define GUJARATI_TOK 342
  166. #define ORIYA_TOK 343
  167. #define KANNADA_TOK 344
  168. #define SANSKRIT_TOK 345
  169. #define ENDLANG_TOK 346
  170. #define SETIFM_TOK 347
  171. #define SETFONT_TOK 348
  172. #define YYERRCODE 256
  173. short yylhs[] = {                                        -1,
  174.     0,    0,    0,    3,    0,    1,    1,    1,    1,    1,
  175.     1,    1,    1,    1,    1,    1,    2,    5,    2,    7,
  176.     2,    2,    2,    2,    4,    4,    4,    9,    9,   10,
  177.    10,   10,   13,   13,   13,   12,   12,   12,   12,   12,
  178.    12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
  179.    12,   12,   12,   14,   14,   14,   14,   14,   14,   14,
  180.    14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
  181.    14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
  182.    14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
  183.    14,   14,   14,   14,   14,   14,   14,   14,   14,   11,
  184.    11,   11,   11,   11,   11,   11,   11,    6,    8,    8,
  185.    15,   15,
  186. };
  187. short yylen[] = {                                         2,
  188.     0,    2,    2,    0,    5,    1,    1,    1,    1,    1,
  189.     1,    1,    1,    1,    1,    1,    0,    0,    3,    0,
  190.     3,    2,    2,    1,    1,    2,    2,    1,    1,    1,
  191.     2,    1,    1,    2,    2,    1,    1,    1,    1,    1,
  192.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  193.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  194.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  195.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  196.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  197.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  198.     1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
  199.     1,    1,
  200. };
  201. short yydefred[] = {                                      1,
  202.     0,    8,    6,    7,    9,   11,   12,   13,   14,   15,
  203.    16,   10,    2,    3,    4,    0,   24,    0,  111,  112,
  204.    23,    5,    0,    0,    0,  109,   36,   37,   38,   39,
  205.    40,   41,   42,   43,   44,   45,   46,   47,   48,   49,
  206.    50,   51,   52,   53,   54,   55,   56,   57,   58,   59,
  207.    60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
  208.    70,   71,   72,   73,   74,   75,   76,   77,   78,   79,
  209.    80,   81,   82,   83,   84,   85,   86,   87,   88,   89,
  210.    90,   91,   92,   93,   94,   95,   98,   99,   96,   97,
  211.   100,  101,  103,  104,  102,  105,  106,  107,    0,   25,
  212.    28,   29,   30,    0,   33,  108,   21,  110,   27,   26,
  213.    35,   31,   34,
  214. };
  215. short yydgoto[] = {                                       1,
  216.    15,   18,   16,   99,   23,  107,   24,   25,  100,  101,
  217.   102,  103,  104,  105,   26,
  218. };
  219. short yysindex[] = {                                      0,
  220.   175,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  221.     0,    0,    0,    0,    0, -182,    0,  161,    0,    0,
  222.     0,    0,  148, -254, -253,    0,    0,    0,    0,    0,
  223.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  224.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  225.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  226.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  227.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  228.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  229.     0,    0,    0,    0,    0,    0,    0,    0,  -80,    0,
  230.     0,    0,    0,   73,    0,    0,    0,    0,    0,    0,
  231.     0,    0,    0,
  232. };
  233. sho